Проблема с вызовом repr других объектов в своём собственном методе repr заключается в том, что нельзя гарантировать, что ни один из других объектов не равен self, и вызов не окажется рекурсивным:
In : p = Pair(1, 2) In : p Out: Pair(1, 2) In : p.right = p In : p Out: [...] RecursionError: maximum recursion depth exceeded while calling a Python object
Чтобы просто решить эту проблему, можно использовать декоратор reprlib.recursive_repr:
Проблема с вызовом repr других объектов в своём собственном методе repr заключается в том, что нельзя гарантировать, что ни один из других объектов не равен self, и вызов не окажется рекурсивным:
In : p = Pair(1, 2) In : p Out: Pair(1, 2) In : p.right = p In : p Out: [...] RecursionError: maximum recursion depth exceeded while calling a Python object
Чтобы просто решить эту проблему, можно использовать декоратор reprlib.recursive_repr:
Tata Power whose core business is to generate, transmit and distribute electricity has made no money to investors in the last one decade. That is a big blunder considering it is one of the largest power generation companies in the country. One of the reasons is the company's huge debt levels which stood at ₹43,559 crore at the end of March 2021 compared to the company’s market capitalisation of ₹44,447 crore.
Telegram announces Search Filters
With the help of the Search Filters option, users can now filter search results by type. They can do that by using the new tabs: Media, Links, Files and others. Searches can be done based on the particular time period like by typing in the date or even “Yesterday”. If users type in the name of a person, group, channel or bot, an extra filter will be applied to the searches.